package com.xxl.job.executor.service.jobhandler;

import com.ruoyi.business.service.ICustVaService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Monnify虚拟账号生成接口重试
 *
 * @author cyh
 */
@Slf4j
@Component
public class CustVAExtApiRetryJob {

    @Autowired
    private ICustVaService custVaService;

    @XxlJob("custVAExtApiRetryJobHandler")
    public void run() {
        XxlJobHelper.log("客户虚拟账号生成重试任务 Start >>>>>>>>>>");

        try {
            XxlJobHelper.log("处理 paystack VA 相关接口重试");
            custVaService.dealPaystackVaRetry();
        } catch (Exception e) {
            log.error("Paystack VA 重试异常", e);
        }

        try {
            XxlJobHelper.log("处理 monnify VA 相关接口重试");
            custVaService.dealMonnifyVaRetry();
        } catch (Exception e) {
            log.error("Monnify VA 重试异常", e);
        }

        XxlJobHelper.log("客户账号生成重试任务 End >>>>>>>>>>");
    }
}

